using CustomerContactSystem.Core.Infrastructure.Domain;

namespace CustomerContactSystem.Core.Model {
    public class EnquiryCurrentReferral : Entity {
        public virtual User CurrentlyReferredTo { get; set; }
        public virtual Department CurrentlyReferredToDepartment { get; set; }
        public virtual UserGroup CurrentlyReferredToGroup { get; set; }

        protected override void Validate() {
            if (CurrentlyReferredTo == null || CurrentlyReferredTo.Id == 0) {
                AddBrokenRule(new BusinessRule("CurrentlyReferredTo", "Currently referred to is required!"));
            }

            if (CurrentlyReferredToDepartment == null || CurrentlyReferredToDepartment.Id == 0) {
                AddBrokenRule(new BusinessRule("CurrentlyReferredToDepartment", "Department is required!"));
            }

            if (CurrentlyReferredToGroup == null || CurrentlyReferredToGroup.Id == 0) {
                AddBrokenRule(new BusinessRule("CurrentlyReferredToGroup", "Group is required!"));
            }
        }
    }
}